import * as zrender from "zrender";
import { barHeight, barMargin, unitWidth } from "../../config";

export function getTaskBarMoveLine(chartStartX: number, chartStartY: number, lastScrollX: number, timeScaleWidth: number, posY: number, tasks: Task[]) {
  // 如果越界，不要画蓝色底线
  if (posY < 0 || posY > tasks.length - 1) return null;
  const bottomLine = new zrender.Rect({
    shape: {
      x: chartStartX + lastScrollX,
      y: chartStartY + (barHeight + barMargin) * posY,
      width: timeScaleWidth * unitWidth,
      height: 1
    },
    style: {
      // fill: "lightgray"
      fill: "blue"
    },
    zlevel: 1
  });
  return bottomLine
}
